﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;

namespace WebSite_CodeMan.Sys_CodeMan_Manage
{
    public partial class Admin_Base_Mes : System.Web.UI.Page
    {
        protected string NoReback = string.Empty;
        protected string AllNote = string.Empty;
        protected string NoHtml = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            BaseClass.BaseClass.CheckState();
            if (!IsPostBack)
            {
                LoadData();
            }
        }

        private void LoadData()
        {
            OleDbDataReader DataRead = BLL.WebInfo.GetWebBaseInfo();
            if (DataRead.HasRows)
            {
                DataRead.Read();
                txtCompanyName.Value = Server.HtmlDecode(DataRead["T_WebName"].ToString());
                txtSkin.Value = Server.HtmlDecode(DataRead["T_WebSkin"].ToString());
                txtSPSS.Value = Server.HtmlDecode(DataRead["T_SPSSMes"].ToString());
                txtMail.Value = Server.HtmlDecode(DataRead["T_WebLink"].ToString());
                txtNo.Value = Server.HtmlDecode(DataRead["T_WebNumber"].ToString());
                txtWord.Value = Server.HtmlDecode(DataRead["T_WebWord"].ToString());
                txtKey.Value = Server.HtmlDecode(DataRead["T_WebKey"].ToString());
                txtDes.Value = Server.HtmlDecode(DataRead["T_WebDes"].ToString());
            }
            DataRead.Close();
            DataRead.Dispose();

            string[] strRe = BLL.WebInfo.GetSysSPInfo();
            NoReback = strRe[0];
            AllNote = strRe[1];
            NoHtml = strRe[2];
        }

        protected void BtnSave_Click(object sender, EventArgs e)
        {
            if (BLL.WebInfo.UpdateWebInfo(Server.HtmlEncode(txtCompanyName.Value.Trim()), Server.HtmlEncode(txtMail.Value.Trim()), Server.HtmlEncode(txtKey.Value.Trim()), Server.HtmlEncode(txtNo.Value.Trim()), Server.HtmlEncode(txtDes.Value), Server.HtmlEncode(txtWord.Value), Server.HtmlEncode(txtSkin.Value), Server.HtmlEncode(txtSPSS.Value.Trim())))
            {
                Common.MessageBox.Show(Page, "信息保存成功...", "Admin_Base_Mes.aspx", "suess");
            }
            else
            {
                Common.MessageBox.Show(Page, "信息保存失败，请重试或联系技术人员......", "error");
            }
        }
    }
}
